# coding=utf-8
# 防止中文乱码

from functools import wraps


def singleton(cls):
  instances = {}

  @wraps(cls)
  def getinstance(*args, **kwargs):
    if cls not in instances:
      instances[cls] = cls(*args, **kwargs)
    return instances

  return getinstance
